package hu.tortavar2.client.view.adminpages;

import hu.tortavar2.shared.Shop;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

public class _ShopItem_ extends Composite {

	private static _ShopItem_UiBinder uiBinder = GWT
			.create(_ShopItem_UiBinder.class);

	interface _ShopItem_UiBinder extends UiBinder<Widget, _ShopItem_> {
	}

	public _ShopItem_() {
		initWidget(uiBinder.createAndBindUi(this));
		initFields();
	}

	@UiField HTMLPanel shopItemContainer;
	@UiField Label shopName;
	@UiField Label shopAddress;
	@UiField Label shopPhoneNumber;
	@UiField Anchor deleteShop;
	

	public _ShopItem_(Shop shop) {
		initWidget(uiBinder.createAndBindUi(this));
		initFields();
		shopName.setText(shop.getShopName());
		shopAddress.setText(shop.getShopAddress());
		shopPhoneNumber.setText(shop.getShopPhone());
	}
	
	public void setEncodedKey(String encodedKey) {
		shopItemContainer.getElement().setAttribute("encodedKey", encodedKey);
	}
	
	public String getEncodedKey() {
		return shopItemContainer.getElement().getAttribute("encodedKey");
	}
	
	private void initFields() {
		deleteShop.getElement().setClassName("button");
	}
}
